//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.purvar.boot.auto.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.purvar.boot.api.entity.SysAutocodeDetail;
import com.purvar.boot.api.pojo.SysAutocodeDetailEditVo;
import com.purvar.boot.api.pojo.SysAutocodeDetailNewVo;
import com.purvar.boot.api.pojo.SysAutocodeDetailQueryVo;
import com.purvar.boot.api.service.ISysAutocodeDetailService;
import com.purvar.boot.comm.api.vo.Result;
import com.purvar.boot.comm.core.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping({"/auto/"})
@Api(
        tags = {"管理"}
)
public class SysAutocodeDetailController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(SysAutocodeDetailController.class);
    @Autowired
    private ISysAutocodeDetailService iSysAutocodeDetailService;

    public SysAutocodeDetailController() {
    }

    @ApiOperation("新增()数据")
    @PostMapping({"/sysAutocodeDetail/createSysAutocodeDetail"})
    public Result addSysAutocodeDetail(@Validated @RequestBody SysAutocodeDetailNewVo sysAutocodeDetailNewDto) {
        this.iSysAutocodeDetailService.addSysAutocodeDetail(sysAutocodeDetailNewDto);
        return Result.ok();
    }

    @GetMapping({"/sysAutocodeDetail/listSysAutocodeDetail"})
    @ApiOperation(
            value = "获取()数据列表",
            notes = "获取()数据列表"
    )
    public Result<IPage<SysAutocodeDetail>> listPage(SysAutocodeDetailQueryVo sysAutocodeDetailQueryVo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
        return this.iSysAutocodeDetailService.listPage(sysAutocodeDetailQueryVo, pageNo, pageSize, req);
    }

    @GetMapping({"/sysAutocodeDetail/getSysAutocodeDetail"})
    @ApiOperation(
            value = "根据主键获取数据",
            notes = "根据登主键获取数据"
    )
    public Result getById(@RequestParam(name = "id") String id) {
        Result result = new Result();
        SysAutocodeDetail sysAutocodeDetail = (SysAutocodeDetail) this.iSysAutocodeDetailService.getById(id);
        result.setSuccess(true);
        result.setResult(sysAutocodeDetail);
        return result;
    }

    @PostMapping({"/sysAutocodeDetail/updateSysAutocodeDetail"})
    @ApiOperation(
            value = "根据主键更新()数据",
            notes = "根据主键更新()数据"
    )
    public Result updateSysAutocodeDetail(@RequestParam(name = "id") String id, @Validated @RequestBody SysAutocodeDetailEditVo sysAutocodeDetailEditDto) {
        Result result = new Result();
        this.iSysAutocodeDetailService.updateSysAutocodeDetail(id, sysAutocodeDetailEditDto);
        result.setSuccess(true);
        result.setMessage("comm.modifySucc");
        return result;
    }

    @PostMapping({"/sysAutocodeDetail/deleteSysAutocodeDetail"})
    @ApiOperation(
            value = "根据主键删除()数据",
            notes = "根据主键删除()数据"
    )
    public Result delSysAutocodeDetail(@RequestParam(name = "id") String id) {
        Result result = new Result();
        this.iSysAutocodeDetailService.removeById(id);
        return result;
    }

    @PostMapping({"/sysAutocodeDetail/getTableVos"})
    public Result getTableVos() {
        Result result = new Result();
        result.setResult(this.iSysAutocodeDetailService.getTableVos());
        return result;
    }
}
